<?php 
header('Content-Type: text/xml');
include("../db/opendb.php");
include("functions.php");

$howmany = 10;

$query = "SELECT * FROM zillow_guesses order by cur_date";

$result = mysql_query($query) or die ("SQL Error".mysql_error());
$xml = "<?xml version='1.0' encoding='UTF-8' ?>";
$xml .= "<points>";
while($row = mysql_fetch_assoc($result))
{
if($row['latitude']!='')
{
$dir = ($row['current_price']>$row['future_price'])?'down':'up';
$xml .= "<point lng='$row[longitude]' lat='$row[latitude]'>";
$xml .= "<address><![CDATA[".$row[address].", ".$row[city]." ".$row[state]."]]></address>";
$xml .= "<username><![CDATA[".$row[user_id]."]]></username>";
$xml .= "<dir><![CDATA[<img src='http://hometally.com/images/$dir.jpg' alt='$dir'/>]]></dir>";
$xml .= "</point>";
}

}
$xml .= "</points>";
echo $xml;
?>

